﻿<UserControl x:Class="IQToolkitCodeGen.View.MenuView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:appCore="clr-namespace:IQToolkitCodeGen.Core"
             mc:Ignorable="d"
             d:DesignHeight="25">
    <Grid>
        <Menu Grid.ColumnSpan="2">
            <MenuItem Header="_File">
                <MenuItem Header="New"
                          Command="{Binding NewCommand}" />

                <MenuItem Header="Open"
                          Command="{Binding OpenCommand}" />

                <MenuItem Header="Save"
                          Command="{Binding SaveCommand}" />

                <MenuItem Header="Save As..."
                          Command="{Binding SaveAsCommand}" />
                <Separator />

                <MenuItem x:Name="RecentFiles"
                          Header="Recent Files"
                          IsEnabled="{Binding HasRecentFiles}"
                          ItemsSource="{Binding RecentFiles}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <appCore:InvokeCommandAction Command="{Binding DataContext.OpenRecentFileCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </MenuItem>
                
                <Separator />
                <MenuItem Header="E_xit"
                          Command="{Binding ExitCommand}" />
            </MenuItem>
        </Menu>
    </Grid>
</UserControl>
